***********************************************************************************************************************************;
* PROJECT: WORKING HOURS 
* This SAS file transfers raw IDA data and AKU data to .dta files keeping only relevant variables and observations for 1994->
***********************************************************************************************************************************;
options nofmterr; 

libname rawdata 'G:\Data\Rawdata\706991\Eksterne data';
libname ida 'G:\Data\Rawdata\706991';

proc export data=ida.familie (keep=familie_id aar c_antboernf c_aldaeldst c_aldyngst where=(aar>"1993")) outfile="D:\Data\workdata\706991\Hours2023\rawdata\familie.dta" replace;
run;

proc export data=ida.idan (keep=pnr aar job_type ansaar lbnr job_cvrnr where=(aar>"1993")) outfile="D:\Data\workdata\706991\Hours2023\rawdata\idan.dta";
run;

proc export data=ida.idap (keep=pnr aar erhverv_1979 erhverv_akk where=(aar>"1993")) outfile="D:\Data\workdata\706991\Hours2023\rawdata\idap.dta";
run;

proc export data=ida.idas (keep=lbnr aar ARB_BRANCHE_DB7793 ARB_BRANCHE_DB03 ARB_BRANCHE_DB07 where=(aar>"1993")) outfile="D:\Data\workdata\706991\Hours2023\rawdata\idas.dta";
run;

proc export data=ida.personer (keep=pnr aar alder koen civst familie_nr where=(aar>"1993")) outfile="D:\Data\workdata\706991\Hours2023\rawdata\personer.dta";
run;

proc export data=ida.udda (keep=pnr aar hfaudd where=(aar>"1993")) outfile="D:\Data\workdata\706991\Hours2023\rawdata\udda.dta";
run;

data Ras1; set ida.ras(keep=pnr aar job_socio_kode JOB_SEKTOR_KODE JOB_FUNKTION_KODE where=(aar>"1993")); if job_socio_kode in(131:135);
run; 

proc export data=work.Ras1 (keep=pnr aar job_socio_kode JOB_SEKTOR_KODE JOB_FUNKTION_KODE where=(aar>"1993")) outfile="D:\Data\workdata\706991\Hours2023\rawdata\ras.dta";
run;

proc export data=ida.firm (keep=cvrnr oms_firm eksport_ialt aar) outfile="D:\Data\workdata\706991\Hours2023\rawdata\firm.dta";
run;



*****************************************************************************************************************;
**************************************** AKU DATA TRANSFER TO STATA FILES ****************************************
*****************************************************************************************************************;

*AKU files from 1994-2003 are obtained as *.dta directly from Statistics Denmark;

proc export data=rawdata.Aauaku_041 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_041.dta";
run;
proc export data=rawdata.Aauaku_042 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_042.dta";
run;
proc export data=rawdata.Aauaku_043 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_043.dta";
run;
proc export data=rawdata.Aauaku_044 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_044.dta";
run;

proc export data=rawdata.Aauaku_051 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_051.dta";
run;
proc export data=rawdata.Aauaku_052 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_052.dta";
run;
proc export data=rawdata.Aauaku_053 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_053.dta";
run;
proc export data=rawdata.Aauaku_054 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_054.dta";
run;

proc export data=rawdata.Aauaku_061 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_061.dta";
run;
proc export data=rawdata.Aauaku_062 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_062.dta";
run;
proc export data=rawdata.Aauaku_063 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_063.dta";
run;
proc export data=rawdata.Aauaku_064 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_064.dta";
run;

proc export data=rawdata.Aauaku_071 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_071.dta";
run;
proc export data=rawdata.Aauaku_072 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_072.dta";
run;
proc export data=rawdata.Aauaku_073 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_073.dta";
run;
proc export data=rawdata.Aauaku_074 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_074.dta";
run;

proc export data=rawdata.Aauaku_081 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_081.dta";
run;
proc export data=rawdata.Aauaku_082 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_082.dta";
run;
proc export data=rawdata.Aauaku_083 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_083.dta";
run;
proc export data=rawdata.Aauaku_084 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_084.dta";
run;

proc export data=rawdata.Aauaku_091 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_091.dta";
run;
proc export data=rawdata.Aauaku_092 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_092.dta";
run;
proc export data=rawdata.Aauaku_093 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_093.dta";
run;
proc export data=rawdata.Aauaku_094 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_094.dta";
run;

proc export data=rawdata.Aauaku_101 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_101.dta";
run;
proc export data=rawdata.Aauaku_102 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_102.dta";
run;
proc export data=rawdata.Aauaku_103 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_103.dta";
run;
proc export data=rawdata.Aauaku_104 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_104.dta";
run;

proc export data=rawdata.Aauaku_111 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_111.dta";
run;
proc export data=rawdata.Aauaku_112 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_112.dta";
run;
proc export data=rawdata.Aauaku_113 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_113.dta";
run;
proc export data=rawdata.Aauaku_114 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_114.dta";
run;

proc export data=rawdata.Aauaku_121 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_121.dta";
run;
proc export data=rawdata.Aauaku_122 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_122.dta";
run;
proc export data=rawdata.Aauaku_123 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_123.dta";
run;
proc export data=rawdata.Aauaku_124 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_124.dta";
run;

proc export data=rawdata.Aauaku_131 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_131.dta";
run;
proc export data=rawdata.Aauaku_132 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_132.dta";
run;
proc export data=rawdata.Aauaku_133 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_133.dta";
run;
proc export data=rawdata.Aauaku_134 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_134.dta";
run;

proc export data=rawdata.Aauaku_141 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_141.dta";
run;
proc export data=rawdata.Aauaku_142 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_142.dta";
run;
proc export data=rawdata.Aauaku_143 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_143.dta";
run;
proc export data=rawdata.Aauaku_144 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_144.dta";
run;

proc export data=rawdata.Aauaku_151 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_151.dta";
run;
proc export data=rawdata.Aauaku_152 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_152.dta";
run;
proc export data=rawdata.Aauaku_153 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_153.dta";
run;
proc export data=rawdata.Aauaku_154 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_154.dta";
run;

proc export data=rawdata.Aauaku_161 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_161.dta";
run;
proc export data=rawdata.Aauaku_162 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_162.dta";
run;
proc export data=rawdata.Aauaku_163 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_163.dta";
run;
proc export data=rawdata.Aauaku_164 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_164.dta";
run;

proc export data=rawdata.Aauaku_171 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_171.dta";
run;
proc export data=rawdata.Aauaku_172 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_172.dta";
run;
proc export data=rawdata.Aauaku_173 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_173.dta";
run;
proc export data=rawdata.Aauaku_174 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_174.dta";
run;

proc export data=rawdata.Aauaku_181 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_181.dta";
run;
proc export data=rawdata.Aauaku_182 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_182.dta";
run;
proc export data=rawdata.Aauaku_183 outfile="D:\Data\Workdata\706991\Hours2023\rawdata\AKU\aauaku_183.dta";
run;


